package org.opens.javaskill.jvm.classloader;

import org.junit.Test;

/**
 * @Date 2020/10/25 13:01
 * @Created by 99126
 */
public class LoaderClass {

    /**
     * 功能:
     * <p>验证同一个对象对应的java.lang.Class对象是否相同</p>
     * 输出:
     * <pre>
     *  true
     *  true
     *  true
     *  true
     *  true
     *  true
     * </pre>
     * 说明:
     * <pre>
     *      1. 可以发现, 完全相同.
     * </pre>
     */
    @Test
    public void test22() {
        MyObject myObject1 = new MyObject();
        MyObject myObject2 = new MyObject();
        MyObject myObject3 = new MyObject();
        MyObject myObject4 = new MyObject();

        System.out.println(myObject1.getClass().equals(myObject2.getClass()));
        System.out.println(myObject1.getClass().equals(myObject3.getClass()));
        System.out.println(myObject1.getClass().equals(myObject4.getClass()));

        System.out.println(myObject1.getClass() == myObject2.getClass());
        System.out.println(myObject1.getClass() == myObject3.getClass());
        System.out.println(myObject1.getClass() == myObject4.getClass());
    }

}

class MyObject {

}